package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.IdentifierNotContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ExpressionInContext;

/**
 * in 表达式语法遍历
 * 
 * @author zwd
 *
 */
public class ExpressionInVisitor extends AbsCQLParserBaseVisitor<ExpressionInContext> {

	private ExpressionInContext context = null;

	public ExpressionInVisitor() {
		context = new ExpressionInContext();
	}

	@Override
	protected ExpressionInContext defaultResult() {
		return context;
	}

	@Override
	public ExpressionInContext visitIdentifierNot(@NotNull IdentifierNotContext ctx) {
		context.setNot(true);
		return context;
	}
	
	@Override
	public ExpressionInContext visitExpression(@NotNull ExpressionContext ctx) {
		ExpressionVisitor visitor = new ExpressionVisitor();
        context.getExpressions().add(visitor.visit(ctx));
        return context;
	}

}
